<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/template/template.xhtml"
	xmlns:s="http://sduept.security.el/func">
	<ui:define name="head">

		<style type="text/css">
.ui-datalist-empty-message {
	/* height: 100px; */
	min-height: 100px;
}

.ui-datalist-content {
	/* height: 100px; */
	min-height: 100px;
}

.zdhb {
	background: #6197e6;
}

.qtyc {
	background: #c7c7c7;
}

.dwgz {
	background: #ffa988;
}

.zhtd {
	background: #fafbc0;
}

.ui-datatable-scrollable-header-box {
	margin-left: 0px;
	margin-right: 15px !important;
}
</style>
	</ui:define>
	<ui:define name="content">
		<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
			<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
			<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
		</p:confirmDialog>
		<div id="headDiv" class="box box-solid with-border">
			<h:form id="formLog">
				<div class="box-header" id="queryDiv">
					<p:outputLabel for="popupLogs" value="记录时间：" />
					<p:calendar id="popupLogs" navigator="true" value="#{runlogController.queryDate1}"
						pattern="yyyy-MM-dd" maxdate="Date()">
					</p:calendar>
					<p:outputLabel for="popupLoge" value="至 " style="margin-right:5px;margin-left:5px;" />
					<p:calendar id="popupLoge" navigator="true" value="#{runlogController.queryDate2}"
						pattern="yyyy-MM-dd" maxdate="Date()">
					</p:calendar>
					<p:outputLabel for="searchLike" value="日志类型：" style="margin-left:10px;" />
					<h:selectOneMenu id="queryTxt" value="#{runlogController.selectedType}"
						style="width:130px;margin-right:20px;height:30px">
						<f:selectItem itemLabel="全部" itemValue="" />
						<f:selectItems value="#{runlogController.allTypes}" var="item" />
						<p:ajax event="change" listener="#{runlogController.queryByTime()}" update="form:dataTb" />
					</h:selectOneMenu>
					<p:outputLabel for="searchLike" value="全局检索：" />
					<p:inputText id="searchLike" value="#{runlogController.searchLike}" style="width:150px" />
					<p:commandButton icon="ui-icon-search" value="查询" id="query2" update="form:dataTb toolbar_s"
						oncomplete="getTableScrollHeight();" actionListener="#{runlogController.queryByTime}"
						style="margin-left:5px;">
					</p:commandButton>
					<p:commandButton icon="ui-icon-refresh" value="重置" style="margin-left:5px;"
						oncomplete="getTableScrollHeight();" actionListener="#{runlogController.resetQuery}"
						update=" queryTxt searchLike form:dataTb popupLogs popupLoge toolbar_s" />
				<!-- 	<div class="box-tools pull-right">
						<button type="button" id="selectButton" title="高级查询" class="btn btn-default"
							onclick="onSelectDivClick();" style="margin-right: 50px;">
							<span id="selectButtonIcon" class="fa fa-caret-down">高级查询</span>
						</button>
					</div> -->
				</div>
				<!-- <div class="panel-collapse collapse" id="selectDiv">
					<p:outputLabel for="searchLike" value="全局检索：" />
					<p:inputText id="searchLike" value="#{runlogController.searchLike}" style="width:150px" />
				</div> -->
				<div id="toolbarDiv">
					<p:toolbar id="toolbar_s">
						<f:facet name="left">
							<p:growl id="msgsLog" showDetail="true" />
							<p:commandButton update="editForm:editDetailLg form:dataTb"
								oncomplete="PF('editDlgLog').show()"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_ddyxrz_bj')}" icon="ui-icon-pencil"
								value="编辑" disabled="#{runlogController.selectLog == null}">
								<f:setPropertyActionListener value="#{runlogController.selectLog}"
									target="#{runlogController.selectLog}"
									rendered="#{s:hasPermission(session,'bhyx_bhrb_ddyxrz_bj')}" />
							</p:commandButton>
							<p:commandButton value="删除" icon="ui-icon-trash"
								update="form:dataTb  formLog:msgsLog toolbar_s"
								actionListener="#{runlogController.deleteLog}"
								disabled="#{runlogController.selectLog == null}" oncomplete="getTableScrollHeight();"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_ddyxrz_sc')}">
								<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
							</p:commandButton>
							<p:commandButton value="故障生成" icon="ui-icon-refresh" update="formLog:msgsLog"
								actionListener="#{runlogController.reGenerateFault}"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_ddyxrz_gzsc')}"
								disabled="#{runlogController.selectLog == null}" />
							<p:commandButton value="故障生成规则配置" icon="ui-icon-gear"
								onclick="MyModal.showModal('/ui/library/standardlibrary_dialog.xhtml?ClassName=FaultETLLibrary',800,500,'故障生成规则配置')"
								rendered="#{s:hasPermission(session,'bhyx_bhrb_ddyxrz_gzscgzpz')}" />
						</f:facet>
					</p:toolbar>
				</div>
			</h:form>
		</div>
		<div id="infoDiv" class="box box-solid with-border">
			<h:form id="form">
				<p:growl id="msgs" showDetail="true" />
				<p:dataTable id="dataTb" var="item" value="#{runlogController.log}"
					selection="#{runlogController.selectLog}" rowKey="#{item.id}" style="margin-bottom:0"
					emptyMessage="无记录" rows="20" paginator="true" rowIndexVar="ite"
					paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} 
								{RowsPerPageDropdown}"
					widgetVar="dataTb" scrollable="true" rowStyleClass="#{runlogController.getRowClass(item)}"
					rowsPerPageTemplate="20,50,100" paginatorPosition="bottom">
					<f:facet name="{Customization}">
						<p:outputLabel value="总计：#{runlogController.log.size()} 条记录" style="margin-right:20px;"></p:outputLabel>
					</f:facet>
					<p:ajax event="rowSelectRadio" listener="#{runlogController.RowSelect}"
						update="formLog:toolbar_s"></p:ajax>
					<p:column selectionMode="single" width="10" style="text-align:center" />
					<p:column width="10" headerText="序号 ">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column width="15" headerText="记录人">
						<h:outputText value="#{item.recorder}" />
					</p:column>
					<p:column width="30" headerText="记录时间">
						<h:outputText value="#{item.time}">
							<f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" />
						</h:outputText>
					</p:column>
					<p:column width="120" headerText="日志内容">
						<h:outputText escape="false" value="#{runlogController.replaceWithBr(item.log_contents)}" />
					</p:column>
					<p:column width="30" headerText="日志类型">
						<h:outputText value="#{item.log_type}" />
					</p:column>
				</p:dataTable>
			</h:form>
			<h:form id="editForm">
				<p:dialog widgetVar="editDlgLog" id="editDlgLog" header="编辑" modal="true" width="800"
					height="300">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton value="保存" icon="ui-icon-disk" update="form:dataTb formLog:msgsLog"
								oncomplete="PF('editDlgLog').hide();getTableScrollHeight()"
								actionListener="#{runlogController.update}" />
						</f:facet>
					</p:toolbar>
					<p:outputPanel id="editDetailLg">
						<p:panelGrid rendered="#{not empty runlogController.selectLog}" style="width:100%">
							<p:row>
								<p:column>
									<h:outputText value="日志类型:" />
								</p:column>
								<p:column>
									<h:selectOneMenu style="width:100%;height:30px"
										value="#{runlogController.selectLog.log_type}">
										<f:selectItems value="#{runlogController.allTypes}" />
									</h:selectOneMenu>
								</p:column>
								<p:column>
									<h:outputText value="记录人:" />
								</p:column>
								<p:column>
									<p:inputText label="content" required="true" requiredMessage="记录人为必填项"
										value="#{runlogController.selectLog.recorder}" style="width:100%;">
									</p:inputText>
								</p:column>
								<p:column>
									<h:outputText value="时间:" />
								</p:column>
								<p:column>
									<p:calendar value="#{runlogController.selectLog.time}" navigator="true"
										pattern="yyyy-MM-dd HH:mm:ss" showHour="true" showMinute="true" showSecond="true" />
								</p:column>
							</p:row>
							<p:row>
								<p:column>
									<h:outputText value="日志内容:" />
								</p:column>
								<p:column colspan="5">
									<p:inputTextarea rows="8" label="content" autoResize="false"
										value="#{runlogController.selectLog.log_contents}" style="width:100%;">
									</p:inputTextarea>
								</p:column>
							</p:row>
						</p:panelGrid>
					</p:outputPanel>
				</p:dialog>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script type="text/javascript" src="/resources/plugins/layer/layer.js" />
		<script type="text/javascript" src="/resources/js/mymodal.js" />
		<script src="/resources/js/tables/singleScrollTable.js" />
	</ui:define>
</ui:composition>